# Copyright 2010-2025 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Description: java wrapping of the code in ../

load("//bazel:swig_java.bzl", "ortools_java_wrap_cc")

config_setting(
    name = "on_linux",
    constraint_values = ["@platforms//os:linux"],
)

config_setting(
    name = "on_macos",
    constraint_values = ["@platforms//os:macos"],
)

config_setting(
    name = "on_windows",
    constraint_values = ["@platforms//os:windows"],
)

filegroup(
    name = "vector_swig",
    srcs = [
        "vector.i",
    ],
    visibility = ["//visibility:public"],
)

filegroup(
    name = "proto_swig",
    srcs = [
        "proto.i",
    ],
    visibility = ["//visibility:public"],
)

filegroup(
    name = "sorted_interval_list_swig",
    srcs = [
        "sorted_interval_list.i",
    ],
    visibility = ["//visibility:public"],
)

ortools_java_wrap_cc(
    name = "sorted_interval_list",
    src = "sorted_interval_list.i",
    package = "com.google.ortools.util",
    swig_includes = [
        ":vector_swig",
        "//ortools/base:base_swig",
    ],
    swig_opt = select({
        "on_linux": "-DSWIGWORDSIZE64",
        "//conditions:default": "",
    }),
    visibility = ["//visibility:public"],
    deps = [
        "//ortools/util:sorted_interval_list",
    ],
)
